1. Field of the Invention
The present invention relates to computer graphics. More particularly, the present invention relates to methods, systems, and computer program products for filtering textures applied to a surface of a computer-generated object.
2. Related Art
Applying textures to the surfaces of computer generated objects greatly enhances the visual realism of a computer generated image or computer scene. As would be known to a person skilled in the relevant computer graphics art, it is very difficult to model intricate surface details of objects using geometric primitives or polygons (e.g., triangles). This difficulty however can be overcome in many instances by a process known in the relevant art as texture mapping.
The process of texture mapping involves mapping or applying a texture image to a surface of a computer-generated object or graphical model as the object is rendered. More particularly, the process of texture mapping involves sampling intensity data (i.e., texels) of a texture image during the rendering of a computer scene. The sampled texels of the texture image are used to generate pixel intensity values or color for the pixels of the final computer scene.
While the process of texture mapping has many benefits, it also has some undesirable effects. For example, one undesirable effect produced by the process of texture mapping is a form of image distortion known in the relevant art as aliasing. Aliasing is caused by the use of rendering techniques that assign an intensity value or color of a primitive or texture sample being rendered to a pixel of the final computer scene, regardless of whether the primitive or texture sample covers all or only a portion of the pixel of the final scene. Aliasing results in computer scenes that have jagged edges.
In real time graphics systems, aliasing is a particularly significant problem. Because real time graphics systems must compute all the pixels of a computer scene in a very short, fixed duration of time, real time graphics systems make approximations in both the size and shape of the area of a texture image that should be sampled during rendering. The area of the texture image sampled during rendering (commonly referred to in the relevant computer graphics art as a filter footprint) defines which texels of the texture image are used to compute the intensity values of the pixels of the computer scene. These approximations add distortion to the final computer scene.
In order to reduce the amount of aliasing that results from the process of texture mapping, some computers are equipped with specially designed graphics hardware that allows pre-filtered texture images (called MIP-Maps) to be stored in a texture memory and accessed during the rendering of a computer scene. Using pre-filtered texture images to render a computer scene helps to eliminate some of the image artifacts caused by texture mapping, and it shortens the amount of time needed to render a computer scene. Some of the known available features of specially designed graphics hardware include the ability to perform bilinear and/or trilinear filtering of texture images during the rendering of a computer scene. Another feature known as anisotropic filtering is described in a recent U.S. Patent to Gabriel et al., titled xe2x80x9cMethod and System for Texture Mapping Images with Anisotropic Filtering,xe2x80x9d which is incorporated in its entirety herein by reference. As would be known to a person skilled in the relevant art, however, available graphics hardware, including available specially designed graphics hardware, has many limitations.
What is needed is a new method for filtering textures that overcomes the deficiencies and limitations discussed above.
The present invention provides a method, system, and computer program product for filtering textures applied to a surface of a computer-generated object. The filtering process of the present invention can be performed either by conducting multiple passes through a graphics pipeline having a single texture unit or by conducting one pass through a graphics pipeline having multiple texture units. The filtering process of the present invention can also be performed by conducting multiple passes through a graphics pipeline having multiple texture units.
In one embodiment, the filtering process is performed by conducting at least two passes through a graphics pipeline having a single texture unit. In this embodiment, during a first pass through the graphics pipeline, rendering data is received for an object from an application program, a first set of texture coordinates for a pixel of the object is generated, a first filtered texture sample from a texture image is obtained based on the first set of texture coordinates, and the first filtered texture sample is stored in a frame buffer. During a second pass through the graphics pipeline, a second set of texture coordinates is generated for the pixel of the object being rendered, a second filtered texture sample from the texture image is obtained based on the second set of texture coordinates, and the second filtered texture sample is blended with the first filtered texture sample to produce, for example, an anisotropicly filtered pixel. The anisotropicly filtered pixel is stored in the frame buffer. The second set of texture coordinates (and therefore the obtained filtered texture sample) is offset from the first set of texture coordinates. The steps of this embodiment can be repeated, if necessary, to achieve greater degrees of filtering.
In another embodiment, the filtering process according to the present invention is performed during a single pass through a graphics pipeline having multiple texture units. In this embodiment, rendering data is received for an object or a graphics primitive from an application program. Next, a first and a second set of texture coordinates are generated for a pixel of the object. A first texture unit is used to obtain a first filtered texture sample from the texture image based on the first set of texture coordinates. A second texture unit, operating in parallel with the first texture unit, is used to obtain a second filtered texture sample from the texture image based on the second set of texture coordinates. The first and second filtered texture samples are then blended to produce, for example, an anisotropicly filtered pixel. The anisotropicly filtered pixel is stored in a frame buffer. The steps of this embodiment can be repeated, if necessary, or graphics subsystems having more than two texture units can be used, to support greater degrees of filtering.
In the embodiments above, the location of each set of texture coordinates is displaced from the others sets of texture coordinates based upon projected screen space derivatives to more accurately assemble the texel footprint. The computation of the delta positions for each set of texture coordinates can be performed by a software application program, by middleware, or by graphics driver software or hardware.